Conversation
…delete_all `delete_all` was the only method in `CouchbaseOrm_Relation` still using the global `CouchbaseOrm::Connection.bucket`. All other storage accesses (`to_n1ql`, `update_all`, `execute`, `first`, `last`) correctly use `@model.bucket` or `@model.cluster`. This inconsistency was a historical oversight: `delete_all` was introduced in the first commit of the relation class before `@model.bucket` existed, and was never updated when the abstraction was added in later commits. This fix makes `delete_all` consistent with the rest of the class and enables per-model dynamic connection routing (e.g. Couchbase Capella).
Summary of ChangesHello @pimpin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a long-standing inconsistency in the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly updates delete_all to use @model.bucket instead of the global CouchbaseOrm::Connection.bucket, which improves consistency and enables per-model connection routing. The change is well-justified and aligns with the behavior of other methods in the class. I have one suggestion to further simplify the code in the delete_all method.
| CouchbaseOrm::logger.debug{ "Delete all: #{self}" } | ||
| ids = query.to_a | ||
| CouchbaseOrm::Connection.bucket.default_collection.remove_multi(ids) unless ids.empty? | ||
| @model.bucket.default_collection.remove_multi(ids) unless ids.empty? |
There was a problem hiding this comment.
Problem
CouchbaseOrm_Relation#delete_allwas hardcodingCouchbaseOrm::Connection.bucketinstead of using@model.bucket, making it inconsistent with every other storage access in the same class (to_n1ql,update_all,execute,first,last).Root cause
This was a historical oversight.
delete_allwas introduced in the very first commit of the relation class (468dbbd - Add basic relation, Sep 2022), before@model.bucketexisted. When@model.bucketwas added in subsequent commits, all new methods adopted it butdelete_allwas never updated — it kept working silently because in a single-cluster setup both references resolve to the same bucket.Fix
One-line change: replace
CouchbaseOrm::Connection.bucketwith@model.bucketindelete_all.Impact
delete_allconsistent with the rest ofCouchbaseOrm_Relation